package com.zbf.tspring.tiaojianload;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.io.Resource;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/22  14:42
 * 描述: 创建的条件类
 */
public class TiaoJianLei implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {

        //定义自己的条件
        Resource resource = conditionContext.getResourceLoader().getResource("/com/zbf/tspring/entity/MyUser.class");

        return resource.exists();

    }
}
